<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.ArrayList" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="bb" class="weaver.general.BaseBean"/>
<jsp:useBean id="resourceInfo" class="weaver.hrm.resource.ResourceComInfo"/>
<%
    JSONObject jsonData = new JSONObject();
    String ids = Util.null2String( request.getParameter( "ids" ) );//ids
    String sql = "select lxmc,lxbh,tbrmc,lxr,lxfs,sqr from formtable_main_696 where id in (" + ids + ")";
    bb.writeLog( sql );
    rs.executeQuery( sql );
    String lxmc = "";
    String lxbh = "";
    List<Map<String, String>> mapList = new ArrayList<>();
    while (rs.next()) {
        Map<String, String> dataMap = new HashMap<>();
        lxmc = Util.null2String( rs.getString( "lxmc" ) );//立项名称
        lxbh = Util.null2String( rs.getString( "lxbh" ) );//立项编号
        String tbrmc = Util.null2String( rs.getString( "tbrmc" ) );//供应商名称
        String tbrmcname = getgysName( tbrmc );
        String lxr = Util.null2String( rs.getString( "lxr" ) );//联系人
        String lxfs = Util.null2String( rs.getString( "lxfs" ) );//联系方式
        String sqr = Util.null2String( rs.getString( "sqr" ) );//供应商人力
        String sqrname = resourceInfo.getLastname(sqr);//供应商人力名称
        dataMap.put( "tbrmc", tbrmc );
        dataMap.put( "tbrmcname", tbrmcname );
        dataMap.put( "lxr", lxr );
        dataMap.put( "lxfs", lxfs );
        dataMap.put( "sqr", sqr );
        dataMap.put( "sqrname", sqrname );
        mapList.add( dataMap );
    }
    String lxmcname = getProjectName( lxmc );
    jsonData.put("lxmc",lxmc);
    jsonData.put("lxmcname",lxmcname);
    jsonData.put("lxbh", lxbh );
    jsonData.put("dataList",mapList);
    out.print( jsonData.toJSONString() );
    bb.writeLog( "jsonData111=" + jsonData.toJSONString() );
%>
<%!
    //获取供应商名称
    public static String getgysName(String id) {
        RecordSet rs = new RecordSet();
        String gysmc = "";
        rs.executeQuery( "select gysmc from uf_srm_gyskpx where id=?", id );
        if (rs.next()) {
            gysmc = Util.null2String( rs.getString( "gysmc" ) );
        }
        return gysmc;
    }

    //获取项目名称
    public static String getProjectName(String id) {
        RecordSet rs = new RecordSet();
        String lxmc = "";
        rs.executeQuery( " select lxmc from formtable_main_694 where id=?", id );
        if (rs.next()) {
            lxmc = Util.null2String( rs.getString( "lxmc" ) );
        }
        return lxmc;
    }
%>

